package cn.wolfcode.crm.service.imp;

import cn.wolfcode.crm.domain.RecruitPlanItem;
import cn.wolfcode.crm.domain.Recruitplan;
import cn.wolfcode.crm.mapper.RecruitplanitemMapper;
import cn.wolfcode.crm.qo.PageResult;
import cn.wolfcode.crm.qo.QueryObject;
import cn.wolfcode.crm.qo.RecruitPlanQueryObject;
import cn.wolfcode.crm.service.IRecruitPlanItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;
@Service
public class RecruitPlanItemServiceImpl implements IRecruitPlanItemService {

    @Autowired
    private RecruitplanitemMapper recruitplanitemMapper;
    @Override
    public int insert(RecruitPlanItem record) {
        return recruitplanitemMapper.insert(record);
    }

    @Override
    public int updateByPrimaryKey(RecruitPlanItem record) {
        return recruitplanitemMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<RecruitPlanItem> selectAll() {
        return recruitplanitemMapper.selectAll();
    }

    @Override
    public PageResult query(QueryObject qo) {
        int count = recruitplanitemMapper.rows(qo);
        if (count == 0) {
            return new PageResult(count, Collections.EMPTY_LIST);
        }else {
            return new PageResult(count, recruitplanitemMapper.queryForList(qo));
        }
    }

    @Override
    public int deleteByPrimaryKey(Long id) {
        return recruitplanitemMapper.deleteByPrimaryKey(id);
    }
}
